{include file="public/header"/}
<link rel="stylesheet" href="/public/static/admin/easyui/layui-v2.6.8/css/layui.css">
<link rel="stylesheet" type="text/css" href="/public/static/admin/easyui/jeasyui/themes/icon.css">
<style>
	body {
		background: #fff;
		font-family: 'Microsoft YaHei', 微软雅黑, 黑体;
		font-weight: normal;
	}

	.ui-combo-wrap {
		position: static;
	}

	.manage-wrap .ui-input {
		width: 250px;
	}

	.base-form {
		*zoom: 1;
		/*margin:0 -10px;*/
	}

	.base-form:after {
		content: '.';
		display: block;
		clear: both;
		height: 0;
		overflow: hidden;
	}

	.base-form .row-item {
		float: left;
		height: 31px;
		margin: 0 10px;
		overflow: visible;
		padding-bottom: 15px;
	}

	.new-liclass .row-item {
		width: 359px;
	}

	.new-liclass .row-item {
		padding-right: 20px;
	}

	.new-liclassm .no_padding {
		padding-right: 0
	}

	#tabContent {
		padding: 0 20px 20px 20px;
		font-size: 14px;
		font-family: 'Microsoft YaHei', 微软雅黑, 黑体;
		color: #333;
	}

	.manage-wrap textarea.ui-input {
		width: 100%;
		height: 80px;
		*vertical-align: auto;
		overflow: hidden;
		box-sizing: border-box;
	}

	/* #manage-form{overflow: hidden;} */
	#warning,
	#warningSku {
		margin-right: 20px;
		color: #FF5F5F;
	}

	#warning input,
	#warningSku input {
		vertical-align: middle;
	}

	.contacters {
		margin-bottom: 10px;
	}

	.contacters h3 {
		margin-bottom: 10px;
		font-weight: normal;
	}

	.ui-jqgrid-bdiv .ui-state-highlight {
		background: none;
	}

	.operating .ui-icon {
		margin: 0;
	}

	.ui-icon-plus {
		background-position: -80px 0;
	}

	.ui-icon-trash {
		background-position: -64px 0;
	}

	.mod-form-rows .ctn-wrap {
		overflow: visible;
	}

	.mod-form-rows .pb0 {
		margin-bottom: 0;
	}

	.liGroup {
		display: block;
		position: relative;
		z-index: 1;
	}

	.liGroup.dn {
		display: none;
	}

	.liGroup h3 {
		background-color: #fff;
		padding: 0 10px 3px 9px;
		margin-bottom: 10px;
		color: #4B4B4B;
		border-bottom: solid 1px #ccc;
	}

	.liGroup a {
		cursor: help;
		border-bottom: dotted #555 1px;
		font-size: 14px;
		font-family: 'Microsoft YaHei', 微软雅黑, 黑体;
		font-weight: normal;
	}

	.liGroup .video-icon {
		cursor: pointer;
		border-bottom: none;
	}

	.ui-tab {
		border-left: none;
		border-bottom: 1px solid #EBEBEB;
		background-color: #fff;
		position: fixed;
		width: 100%;
		top: 0;
		left: 0;
		z-index: 999;
	}

	.ui-tab li {
		border-top: none;
		border-bottom: none;
		border-color: #EBEBEB;
		padding: 0 20px;
	}

	.prop-wrap {
		line-height: 26px;
	}

	.prop-wrap input {
		vertical-align: middle;
		margin-right: 3px;
	}

	.prop-wrap label {
		margin-right: 8px;
	}

	.prop-wrap .content {
		padding: 10px;
	}

	.manage-wrapper .adjust-item label {
		font-size: 14px;
		font-family: 'Microsoft YaHei', 微软雅黑, 黑体;
		color: #333;
		font-weight: bold;
		padding: 10px 0
	}

	.qur-wrap {
		font-size: 14px;
		font-family: 'Microsoft YaHei', 微软雅黑, 黑体;
		color: #333;
		font-weight: bold;
	}

	.qur-wrap span label {
		font-size: 12px;
		font-family: "宋体";
		font-weight: normal;
	}

	#createSku {
		color: #fff;
		border: 1px solid #72ba6e;
		padding: 5px 17px;
		cursor: pointer;
		line-height: 15px;
		display: inline-block;
		vertical-align: middle;
		background: #60c962;
		border-radius: 3px;
	}

	#createSku:hover {
		background: #2bb22e
	}

	.serField,
	.prop-wrap,
	.qur-wrap {
		padding: 10px 0;
		;
		font-size: 14px;
		font-family: 'Microsoft YaHei', 微软雅黑, 黑体;
		color: #333;
		font-weight: bold;
	}

	#isWarranty,
	#isSerNum,
	#isItem,
	#inventoryWarn,
	#earlyStage {
		vertical-align: middle;
		margin-left: 6px;
	}

	.isWarrantyData {
		float: left;
		margin-left: 6px;
	}

	.fl {
		float: left;
	}

	.cle {
		clear: both;
	}

	#patchInputBox {
		padding: 10px;
		border: 1px solid #ccc;
		background-color: #fff;
	}

	.shadow {
		-moz-box-shadow: 1px 1px 3px rgba(0, 0, 0, .4);
		-webkit-box-shadow: 1px 1px 3px rgba(0, 0, 0, .4);
		box-shadow: 1px 1px 3px rgba(0, 0, 0, .4);
	}

	.mod-form-rows .label-wrap {
		width: 85px;
	}

	#tipsBox {
		margin-top: 10px;
		margin-left: 30px;
		width: 460px;
	}

	#tipsBoxNum {
		margin-top: 10px;
		margin-left: 20px;
	}

	#tipsBox p,
	#tipsNum p {
		line-height: 24px;
	}

	#remindBox,
	#remindTitBox,
	#remindTitBoxSecond {
		margin-top: 21px;
		margin-left: 50px;
		width: 285px;
	}

	#remindBox p,
	#remindTitBox p,
	#remindTitBoxSecond p {
		line-height: 24px;
	}

	.h_tit {
		font-size: 16px;
		font-family: 'Microsoft YaHei', 微软雅黑, 黑体;
		font-weight: normal;
		border-bottom: #ccc 1px solid;
		padding: 20px 0 6px 0;
		margin-bottom: 16px;
	}

	.g_left {
		width: 600px;
		float: left;
	}

	.g_right {
		float: left;
	}

	.clear {
		clear: both;
	}

	.chk_blue {
		position: relative;
	}

	.chk_blue input {
		display: inline-block;
		position: absolute;
		width: 16px;
		height: 16px;
		cursor: pointer;
		left: -5px;
		top: 1px;
		opacity: 0;
	}

	#bottomField {
		background-color: rgba(138, 138, 138, 0.21);
		border-radius: 0 0 3px 3px;
		padding: 8px;
		position: fixed;
		right: 25px;
		top: 0;
		z-index: 9999;
	}

	#itemList_list {
		background: #e3e3e3;
		padding: 6px;
	}

	#itemList {
		background: #f5f5f5;
		font-weight: normal;
	}

	#itemList2 {
		background: #f5f5f5;
		padding: 0 10px 10px 10px;
		margin-bottom: 10px;
		font-weight: normal;
	}

	#itemList2 hr {
		height: 0px;
		border: 0;
		border-top: #ccc 1px solid;
		margin: 0;
		padding: 0;
		margin-bottom: 10px;
	}

	#itemList2 p {
		display: none
	}

	#btn-autocreat {
		background: #26b5ff;
		border-radius: 3px;
		color: #fff;
		cursor: pointer;
		display: inline-block;
		line-height: 15px;
		padding: 5px 16px;
		font-size: 14px;
		font-weight: normal;
	}

	#btn-autocreat:hover {
		background: #129ae0
	}

	#autocreat label strong,
	#itemList p strong,
	.manage-wrapper .adjust-item label.lab_tit {
		font-family: 'Microsoft YaHei', 微软雅黑, 黑体;
		font-weight: normal;
		font-size: 16px;
	}

	.gray {
		background: #f1f1f1
	}

	#autocreat {
		margin-bottom: 10px;
	}

	#autocreat span {
		color: #9f9c9c;
		font-weight: normal;
	}

	td.img {
		background: url("/css/img/no_pic.gif") center no-repeat
	}

	td.img:hover {
		cursor: pointer;
	}

	/*商品图片*/
	.goodsImgWrap {
		padding: 15px 20px;
		border-top: 1px #ccc dashed;
		margin-top: 15px;
	}

	.goodsImgWrap .imgs {
		float: left;
	}

	.goodsImgWrap .imgs img {
		float: left;
	}

	.goodsImgWrap .item {
		width: 150px;
		height: 117px;
		border: 1px solid #ccc;
		margin: 10px 10px 0 0;
	}

	.goodsImgWrap .creator {
		float: left;
		position: relative;
		text-align: center;
		color: #8E8E8E;
		background-color: #F5F5F5;
	}

	.goodsImgWrap .creator .plus {
		font-size: 64px;
		line-height: 115px;
		font-family: serif;
	}

	.goodsImgWrap .creator .info {
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
	}

	#gridSku .img {
		padding: 0
	}

	#gridSku .img img {
		float: left;
		width: 100%;
		height: 100%;
	}

	.imgView {
		border: 1px solid #ccc;
		padding: 4px;
		background-color: #fff;
		box-shadow: 1px 1px 1px 1px rgba(204, 204, 204, 0.46);
		border-radius: 3px;
	}

	.item_span {
		position: relative;
		display: block;
		float: left;
	}

	.item_span a {
		cursor: move;
	}

	.item_span a.del {
		position: absolute;
		width: 26px;
		height: 26px;
		background: url("/public//static/admin/css/img/ov_icons_1.png") no-repeat 0 0 #fff;
		border-radius: 3px;
		z-index: 999;
		border: none;
		background-position: 1px -18px;
		top: 20px;
		right: 20px;
		display: none;
		cursor: pointer;

	}

	.item_span:hover .del {
		display: block;
	}

	.item_span .del:hover {
		background-position: -24px -18px;
	}

	.item_span a.important_set {
		position: absolute;
		width: -webkit-calc(100% - 10px);
		width: -moz-calc(100% - 10px);
		width: calc(100% - 10px);
		height: 30px;
		background-color: #858585;
		-moz-opacity: 90%;
		opacity: 90%;
		font-size: 16px;
		text-align: center;
		line-height: 30px;
		color: #fff;
		z-index: 999;
		letter-spacing: 1px;
		bottom: 0px;
		cursor: pointer;
		display: block;
	}

	.item_span a.important {
		position: absolute;
		width: -webkit-calc(100% - 10px);
		width: -moz-calc(100% - 10px);
		width: calc(100% - 10px);
		height: 30px;
		background-color: #858585;
		-moz-opacity: 90%;
		opacity: 90%;
		font-size: 16px;
		text-align: center;
		line-height: 30px;
		color: #fff;
		z-index: 999;
		letter-spacing: 1px;
		display: none;
		bottom: 0px;
		cursor: pointer;
	}

	.item_span:hover .important {
		display: block;
	}

	.creator:hover {
		cursor: pointer;
	}

	/*商品图片 end*/

	.qtyInsert {
		margin-left: 8px;
		font-weight: 100;
		font-size: 12px;
		color: #fff;
		background-color: #B1B1B1;
		padding: 0 5px;
		border-radius: 2px;
		line-height: 19px;
		height: 20px;
		display: inline-block;
	}

	.qtyInsertAfter {
		margin-right: 8px;
		font-weight: 100;
		font-size: 12px;
		color: #fff;
		background-color: #23B317;
		padding: 0 5px;
		border-radius: 2px;
		line-height: 19px;
		height: 20px;
		display: inline-block;
	}

	#gview_gridSku table[aria-labelledby=gbox_gridSku] th div {
		height: 30px;
		line-height: 30px;
	}

	#jdInfo .row-item {
		margin-bottom: 16px;
	}

	.radio input {
		display: none
	}

	.layui-input-inline {
		width: calc(100% - 95px);
	}

	#sxck .layui-anim-upbit {
		padding-bottom: 30px;
	}

	.droplist .list-item:hover {
		background-color: #faffad;
	}

	.layui-form-checked[lay-skin=primary] i {
		border-color: #4dc2e6 !important;
		background-color: #4dc2e6;
	}

	.kucunyujing .contentBoxs1 .layui-form-checkbox[lay-skin=primary] span {
		color: #FF5F5F;
	}

	.duodanwei .layui-form-checkbox[lay-skin=primary] {
		padding-left: 18px;
		display: inline-block;
	}

	.duodanwei .layui-form-checkbox[lay-skin="primary"] span {
		padding-right: 0;
	}

	.goodsType>li>label {
		display: inline-block;
		width: 85px;
		margin-right: 6px;
	}

	.goodsType>li>.ui-tree-wrap {
		width: 260px !important;
	}

	.goodsType>li>.ui-tree-wrap .input-txt {
		width: 230px !important;
	}
</style>

<div id="tabContent">

	<div id="bottomField">
		<div id="toolBottom" class="fr"><span id="groupBtn"><a class="ui-btn ui-btn-sp" id="save">保存</a></span></div>
	</div>

	<!-- 基础资料 -->
	<div class="manage-wrapper layui-form">
		<!-- <a href="http://club.kingdee.com/club/cloudschool/course?cid=759#pid=3415" target="_blank" class="video-icon"></a> -->
		<h2 class="h_tit">基础资料</h2>
		<div id=base-wrap" class="manage-wrap">
			<form id="manage-form" action="">


				<div id="base-form">
					<ul class="mod-form-rows base-form cf new-liclass">
						<li class="row-item">
							<div class="label-wrap"><span class="red spe_red">*</span><label for="number">商品编号</label>
								<span id="tipsNum">
									<img src="/public/static/admin/css/img/wenhao.png"
										style="width: 19px; height: 19px;vertical-align:middle;">
									<div id="tipsBoxNum" class="shadow opera-log-box dn">
										<p>注意事项 :</p>
										<p>为保证编号连续，建议按商品总量设置位数。</p>
										<p>例如 :</p>
										<p>有500个商品，编号位数是3位，为保证商品编号的连续性和可扩展性，</p>
										<p>建议位数加1，即从SP0001开始。</p>
									</div>
								</span>
							</div>
							<div class="ctn-wrap"><input type="text" value="{$info.sn}" class="ui-input" name="sn" id="sn" autocomplete="off"></div>
							<!-- <div class="ctn-wrap"><span class="ui-combo-wrap" id="numberCombo"><i class="trigger"></i></span></div> -->
							<!-- <div class="ctn-wrap">
								<div class="layui-input-inline">
									<select name="modules" lay-search="">
										<option value="">直接选择或搜索选择</option>
										<option value="1">001</option>
										<option value="2">002</option>
										<option value="3">003</option>
										<option value="4">004</option>
										<option value="5">005</option>
										<option value="6">006</option>
										<option value="7">007</option>
										<option value="8">008</option>
										<option value="9">009</option>
									</select>
								</div>
							</div> -->
						</li>
						<li class="row-item">
							<div class="label-wrap"><span class="red spe_red">*</span><label for="name">商品名称</label>
							</div>
							<div class="ctn-wrap"><input type="text" value="{$info.name}" class="ui-input" name="name" id="name" autocomplete="off"></div>
						</li>
						<li class="row-item  no_padding">
							<div class="label-wrap"><label for="barCode">商品条码</label></div>
							<div class="ctn-wrap"><input type="text" value="{$info.code}" class="ui-input" name="code" id="code">
							</div>
						</li>
					</ul>

					<ul class="mod-form-rows base-form cf new-liclass">
						<li class="row-item">
							<div class="label-wrap"><label for="specs">规格型号</label></div>
							<div class="ctn-wrap"><input type="text" value="{$info.model}" class="ui-input" name="model" id="model" /></div>
						</li>

						<!-- 选择商品类别 -->
						<div class="row-item goodsType">
							{include file="admin@select/goods_category"/}
						</div>
						<!-- 下拉树选择（商品类别） -->
						{include file="admin@popup/goods_category"/}

						<li class="row-item  no_padding">
							<div class="label-wrap"><label for="storage">首选仓库</label></div>
							<div class="ctn-wrap ctn-wrap_baseInfo">
								<span id="storage1" style="position: relative;">
									<span class="ui-combo-wrap ui-combo-active" style="width: 259px;">
										<input type="text" class="input-txt" autocomplete="off" style="width: 233px;" id="storageInput1" placeholder="空" value="{$info.store_name}">
										<span class="trigger" style="display: block !important;"></span>
									</span>
									<div class="ui-droplist-wrap baseInfoPopupBox" id="storageList1"
										style="position: absolute; top: 30px; z-index: 1000; width: 259px; display: none; left: 0;">
										<div class="droplist"
											style="position: relative; overflow: auto; min-height: 150px; height: 150px;">
											<div class="list-item" onclick="chooseSelect('1','0','(空)')">(空)</div>
											{volist name="store" id="vo"}
											<div class="list-item" onclick="chooseSelect('1','{$vo.id}','{$vo.name}')">
												{$vo.name}</div>
											{/volist}
										</div>
										<div class="extra-list-ctn">
											<a href="#" class="quick-add-link full-width dib"
												onclick="addStorage();return false;"><i
													class="ui-icon-add tp6"></i>新增</a>
										</div>
									</div>
								</span>
							</div>
						</li>
					</ul>

					<ul class="mod-form-rows base-form cf new-liclass">


						<li class="row-item row-category duodanwei_hide">
							<div class="label-wrap"><label for="unit">计量单位</label></div>
							<div class="ctn-wrap ctn-wrap_baseInfo">
								<span id="storage2" style="position: relative;">
									<span class="ui-combo-wrap ui-combo-active" style="width: 259px;">
										<input type="text" class="input-txt" value="{$info.unit_name}" autocomplete="off" style="width: 233px;"
											id="storageInput2" placeholder="(空)">
										<span class="trigger" style="display: block !important;"></span>
									</span>
									<div class="ui-droplist-wrap baseInfoPopupBox" id="storageList2"
										style="position: absolute; top: 30px; z-index: 1000; width: 259px; display: none; left: 0;">
										<div class="droplist"
											style="position: relative; overflow: auto; min-height: 150px; height: 150px;">
											<div class="list-item" onclick="chooseSelect('2','0','(空)')">(空)</div>
											{volist name="unit" id="vo"}
											<div class="list-item" onclick="chooseSelect('2','{$vo.id}','{$vo.name}')">
												{$vo.name}</div>
											{/volist}
										</div>
										<div class="extra-list-ctn">
											<a href="#" class="quick-add-link full-width dib"
												onclick="addStorage();return false;"><i
													class="ui-icon-add tp6"></i>新增</a>
										</div>
									</div>
								</span>
							</div>
						</li>

						<!-- 初始隐藏的多计量单位 -->
						<li class="row-item  no_padding duodanwei">
							<div class="label-wrap">
								<input type="checkbox" name="" id="moreUnitBtn" lay-skin="primary" title="多单位"
									lay-filter="chkduodanwei">
								<span id="tips">
									<img src="/public/static/admin/css/img/wenhao.png"
										style="width: 19px; height: 19px;vertical-align:middle;">
									<div id="tipsBox" class="shadow opera-log-box dn">
										<p>注意事项 :</p>
										<p>针对单单位商品修改为多单位商品时,可能会造成库存计算误差,一经修改多单位无法更改回原单单位,请谨慎修改。</p>
										<p>例如 :</p>
										<p>1:原单位为"克",但是现在修改为多单位"千克"和"吨",基本单位为"千克"</p>
										<p>2:则该商品之前的单据,和库存统计表里,会用"千克"替换"克"这个单位</p>
										<p>3:数量上是没有变化且正确,但是由于我们认知的原因,认为"千克"=1000"克"</p>
										<p>这就可能造成认知上的数量和库存误差,所以请谨慎修改,一经修改多单位无法更改回原单单位。</p>
									</div>
								</span>
							</div>
							<div class="ctn-wrap ctn-wrap_baseInfo dn duodanwei_show">
								<span id="storage1" style="position: relative;">
									<span class="ui-combo-wrap ui-combo-active" style="width: 259px;">
										<input type="text" class="input-txt" autocomplete="off" style="width: 233px;"
											id="storageInput3" value="{$info.multi_unit_name}" placeholder="空">
										<span class="trigger" style="display: block !important;"></span>
									</span>
									<div class="ui-droplist-wrap baseInfoPopupBox" id="storageList3"
										style="position: absolute; top: 30px; z-index: 1000; width: 259px; display: none; left: 0;">
										<div class="droplist"
											style="position: relative; overflow: auto; min-height: 150px; height: 150px;">
											<div class="list-item" onclick="chooseSelect('3','0','(空)')">(空)
											</div>
											{volist name="multi_unit" id="vo"}
											<div class="list-item"
												onclick="chooseSelect('3','{$vo.id}','{$vo.super_name}')">
												{$vo.super_name}
											</div>
											{/volist}
										</div>
										<div class="extra-list-ctn">
											<a href="#" class="quick-add-link full-width dib"
												onclick="addStorage();return false;"><i
													class="ui-icon-add tp6"></i>新增</a>
										</div>
									</div>
								</span>
							</div>
						</li>

						<li class="row-item row-category dn duodanwei_show">
							<div class="label-wrap"><label for="unit">首选出库单位</label></div>
							<div class="ctn-wrap ctn-wrap_baseInfo">
								<span id="storage2" style="position: relative;">
									<span class="ui-combo-wrap ui-combo-active" style="width: 259px;">
										<input type="text" class="input-txt" autocomplete="off" style="width: 233px;"
											id="storageInput4" value="{$info.first_out_unit_name}" placeholder="空">
										<span class="trigger" style="display: block !important;"></span>
									</span>
									<div class="ui-droplist-wrap baseInfoPopupBox" id="storageList4"
										style="position: absolute; top: 30px; z-index: 1000; width: 259px; display: none; left: 0;">
										<div id="outstock" class="droplist"
											style="position: relative; overflow: auto; min-height: 150px; height: 150px;">

										</div>
									</div>
								</span>
							</div>
						</li>
						<!-- <li class="row-item moreUnit  no_padding">
						<div class="label-wrap"><label for="unit">首选入库单位</label></div>
						<div class="ctn-wrap"><span id="firstPurUnit"></span></div>
					</li> -->
						<li class="row-item row-category dn duodanwei_show">
							<div class="label-wrap"><label for="unit">首选入库单位</label></div>
							<div class="ctn-wrap ctn-wrap_baseInfo">
								<span id="storage2" style="position: relative;">
									<span class="ui-combo-wrap ui-combo-active" style="width: 259px;">
										<input type="text" class="input-txt" autocomplete="off" style="width: 233px;"
											id="storageInput5" value="{$info.first_in_unit_name}" placeholder="空">
										<span class="trigger" style="display: block !important;"></span>
									</span>
									<div class="ui-droplist-wrap baseInfoPopupBox" id="storageList5"
										style="position: absolute; top: 30px; z-index: 1000; width: 259px; display: none; left: 0;">
										<div id="instock" class="droplist"
											style="position: relative; overflow: auto; min-height: 150px; height: 150px;">

										</div>
									</div>
								</span>
							</div>
						</li>
						<!-- 初始隐藏的多计量单位 -->


						<li class="row-item dn">
							<div class="label-wrap"><label for="guarantDate">保质期天数</label></div>
							<div class="ctn-wrap"><input type="text" value="" class="ui-input rate" name="guarantDate"
									id="guarantDate"></div>
						</li>
						<li class="row-item dn">
							<div class="label-wrap"><label for="warnDate">报警天数</label></div>
							<div class="ctn-wrap"><input type="text" value="" class="ui-input rate" name="warnDate"
									id="warnDate"></div>
						</li>
					</ul>

				</div>



				<div class="manage-wrap">
					<div class="liGroup cf">

						<h3 id="priceHelp">
							<a href="#"
								title="各销售价格分别对应客户信息中的客户等级，如：零售价-零售客户，批发价-批发客户...开单时选择客户后再选择该商品，可自动填写相应的价格或折扣">价格策略？</a><a
								href="http://club.kingdee.com/club/cloudschool/course?cid=759#pid=3416" target="_blank"
								class="video-icon">
							</a>
						</h3>

						<div id="priceBox" class="duodanwei_hide">
							<ul class="mod-form-rows base-form cf new-liclass">
								<li class="row-item">
									<div class="label-wrap"><label for="salePrice">零售价</label></div>
									<div class="ctn-wrap"><input type="text" value="" class="ui-input money" name="sale_price" id="sale_price"></div>
								</li>
								<li class="row-item">
									<div class="label-wrap"><label for="wholesalePrice">批发价</label></div>
									<div class="ctn-wrap"><input type="text" value="" class="ui-input money" name="batch_price" id="batch_price"></div>
								</li>
								<li class="row-item no_padding">
									<div class="label-wrap"><label for="vipPrice">VIP会员价</label></div>
									<div class="ctn-wrap"><input type="text" value="" class="ui-input money" name="vip_price" id="vip_price"></div>
								</li>
							</ul>

							<ul class="mod-form-rows base-form cf new-liclass">
								<li class="row-item">
									<div class="label-wrap"><label for="discountRate1">折扣率一(%)</label></div>
									<div class="ctn-wrap"><input type="text" value="" class="ui-input rate" name="discount_rate_one" id="discount_rate_one"></div>
								</li>
								<li class="row-item no_padding">
									<div class="label-wrap"><label for="discountRate2">折扣率二(%)</label></div>
									<div class="ctn-wrap"><input type="text" value="" class="ui-input rate" name="discount_rate_two" id="discount_rate_two"></div>
								</li>
							</ul>

							<ul class="mod-form-rows base-form cf new-liclass">

								<li class="row-item no_padding">
									<div class="label-wrap"><label for="purchasePrice">预计采购价</label></div>
									<div class="ctn-wrap"><input type="text" value="" class="ui-input money" name="estimated_purchase_price" id="estimated_purchase_price" /></div>
								</li>
							</ul>

						</div>

						<div class="grid-wrap dn duodanwei_show" id="priceGrid"
							style="margin-bottom:20px;margin-left:10px;">
							<table id="priceManage">
							</table>
						</div>

					</div>

					<ul class="mod-form-rows" style="margin-left: 10px;">
						<li class="row-item pb0">
							<div class="ctn-wrap" style="line-height: normal;">
								<textarea name="mark" id="mark" class="ui-input ui-input-ph" placeholder="添加备注信息">{$info.mark}</textarea>
							</div>
						</li>
					</ul>
				</div>
			</form>
		</div>


	</div>

	<!-- 商品图片 -->
	<div id="goodsImgWrap" class="goodsImgWrap cf ml10 dn" style="display: block;padding-left: 0;">
		<div class="imgs" id="imgs">
			{volist name="info.imgsList" id="vo"}
			<span class="item_span">
				<a href="/public/uploads/{$vo.path}" data-lightbox="roadtrip">
					<img class="item sonimgs" src="/public/uploads/{$vo.path}" data-id="{$vo.id}">
				</a>
				<a class="del imgdel" href="javascript:" del="0"></a>
				{if condition="$info.main_img_id eq $vo.id"}
				<a id="mainimg" class="important_set" href="javascript:" important="0">主图</a></span>
				{else/}
					<a class="important setmainimg" href="javascript:" important="1">设为主图</a></span>
				{/if}
			</span>
			{/volist}
			<!-- <span class="item_span">
				<a href="https://fdfs-bj-1252177366.cos.ap-beijing.myqcloud.com/795796229585091/图4_20210809110238.jpg"
					data-lightbox="roadtrip"><img class="item"
						src="https://fdfs-bj-1252177366.cos.ap-beijing.myqcloud.com/795796229585091/图4_20210809110238.jpg"
						data-pid="undefined">
				</a>
				<a class="del" href="javascript:" del="0"></a>
				<a class="important_set" href="javascript:" important="0">主图</a>
			</span>
			<span class="item_span">
				<a href="https://fdfs-bj-1252177366.cos.ap-beijing.myqcloud.com/795796229585091/图3_20210809110243.jpg"
					data-lightbox="roadtrip"><img class="item"
						src="https://fdfs-bj-1252177366.cos.ap-beijing.myqcloud.com/795796229585091/图3_20210809110243.jpg"
						data-pid="undefined">
				</a>
				<a class="del" href="javascript:" del="1"></a>
				<a class="important" href="javascript:" important="1">设为主图</a>
			</span> -->

			<div class="creator item" id="addimgs" style="position: relative;">
				<span class="plus">+</span>
				<div class="info">
					<p>添加商品图册</p>
					<p>（最多20张）</p>
				</div>
				<input style="opacity: 0; width: 100%; height:100%; position: absolute; top:0; left: 0;" type="file"
					name="FileUpload" id="FileUpload">
			</div>
		</div>
	</div>

	<!-- 库存预警 -->
	<div class="manage-wrapper mb10 layui-form kucunyujing" style="padding:5px 20px;padding-left: 0;">
		<!--<h2  class="h_tit">库存预警</h2>-->
		<span class="check-wrap adjust-item chk_blue unchecked">
			<input type="checkbox" name="kucunyujing" lay-skin="primary" title="库存预警" lay-filter="chkKucunyujing" id="kucunyujingId">
			<!-- <a href="http://club.kingdee.com/club/cloudschool/course?cid=759#pid=3419" target="_blank" class="video-icon"></a> -->
		</span>
		<div id="manage-wrap" class="manage-wrap ml20 dn">
			<br />
			<div class="cf contentBoxs1" style="margin-left:20px;">
				<!-- <h3>分仓预警</h3> -->
				<span><input type="checkbox" name="fencangyujing" lay-skin="primary" title="启用分仓预警"
						lay-filter="chkFencangyujing" id="fencangyujingId"></span>
				<span class="dn" id="manage_set"><input lay-filter="chkattrsetting" type="checkbox" name=""
						lay-skin="primary" title="根据属性设置" id="chkattrsettingId"></span>

				<br /><br />

				<ul class="mod-form-rows base-form cf" id="manage-kc-info">
					<li class="row-item">
						<div class="label-wrap"><label for="minInventory">最低库存</label></div>
						<div class="ctn-wrap"><input type="text" class="ui-input" name="low_stock" id="low_stock">
						</div>
					</li>
					<li class="row-item">
						<div class="label-wrap"><label for="maxInventory">最高库存</label></div>
						<div class="ctn-wrap"><input type="text" class="ui-input" name="max_stock" id="max_stock">
						</div>
					</li>
				</ul>
				<div class="grid-wrap dn" id="manage-kc-table" style="width: 720px;">
					<table id="gridWarning">
					</table>
					<!-- <div id="pageWarning"></div> -->
				</div>
			</div>
			<br /><br />
		</div>
	</div>

	<!-- 启用序列号管理 -->
	<div class="manage-wrapper mb10 layui-form kucunyujing" style="padding:5px 20px;padding-left: 0;">
		<span class="check-wrap adjust-item chk_blue unchecked">
			<input lay-filter="chksn_manager" type="checkbox" name="" lay-skin="primary" title="启用序列号管理" id="isSerNum">
		</span>
	</div>


	<!-- 商品属性 -->
	<div class="manage-wrapper dn">
		<div id="gooods-wrap" class="manage-wrap">
			<div class="cf">
				<!-- <h3>高级设置</h3> -->
				<div class="row-item prop-wrap on dn">

					<!--<div id="itemList_list">-->
					<span class="check-wrap adjust-item chk_blue unchecked">
						<input type="checkbox" id="isItem" /> <label for="isItem" class="lab_tit">设置商品辅助属性</label><a
							href="http://club.kingdee.com/club/cloudschool/course?cid=759#pid=3417" target="_blank"
							class="video-icon"></a>
					</span>
					<span id="remind">
						<img src="/public/static/admin/css/img/wenhao.png"
							style="width: 19px; height: 19px;vertical-align:middle; padding-left: 20px">
						<div id="remindBox" class="opera-log-box dn">
							<p>注意事项 :</p>
							<p>辅助属性商品,批次商品,序列号商品的成本不会根据单独的辅助属性或者批次或者序列号来核算成本,而是根据商品的维度来计算成本的。</p>
						</div>
					</span>
					<!--</div>-->

					<div class="isItemIn ml20 dn">
						<div class="content" id="itemList">
						</div>
						<div class="content2" id="itemList2">
							<hr />
						</div>

						<div id="autocreat"><label
								for="autoCreat"><strong>自动建立属性组合</strong></label><span>（自动建立组合只能选择三个属性分类）</span> <a
								id="btn-autocreat" class="">快速生成</a></div>
						<div class="grid-wrap">
							<table id="gridSku">
							</table>
						</div>


					</div>

				</div>

				<div class="row-item qur-wrap on dn">
					<span class="check-wrap adjust-item chk_blue unchecked">
						<input type="checkbox" id="isWarranty" /> <label for="isWarranty"
							class="lab_tit">启用批次保质期管理</label><a
							href="https://club.kingdee.com/club/newclub/school/course?product_id=7&cid=1547#pid=5697"
							target="_blank" class="video-icon"></a>
					</span>
					<span class="isWarrantyIn dn">
						<label for="safeDays">保质期天数</label>
						<input type="text" value="" class="ui-input rate" name="safeDays" id="safeDays">
						<label for="advanceDay">报警天数</label>
						<input type="text" value="" class="ui-input rate" name="advanceDay" id="advanceDay">
					</span>
				</div>

				<div class="row-item serField " style="padding-left:0">
					<span class="check-wrap adjust-item chk_blue unchecked">
						<input type="checkbox" name="" lay-skin="primary" title="启用序列号管理" id="isSerNum">
					</span>
				</div>
			</div>

		</div>
	</div>

	<!-- 期初设置 -->
	<div class="manage-wrapper layui-form mt10" style="padding:5px 20px;padding-left: 0;">
		<span class="check-wrap adjust-item chk_blue unchecked">
			<input type="checkbox" name="earlyStage" id="earlyStage" lay-skin="primary" title="期初设置"
				lay-filter="chkqichushezhi">
		</span>
		<span id="remindTit" style="display: none;">
			<img src="/public/static/admin/css/img/wenhao.png"
				style="width: 19px; height: 19px;vertical-align:middle; padding-left: 20px">
			<div id="remindTitBox" class="opera-log-box dn">
				<p>您无期初金额更改权限</p>
				<p>如需修改请联系管理员增加权限</p>
			</div>
		</span>
		<span id="remindTitSecond">
			<img src="/public/static/admin/css/img/wenhao.png"
				style="width: 19px; height: 19px;vertical-align:middle; padding-left: 20px">
			<div id="remindTitBoxSecond" class="opera-log-box dn">
				<p>商品期初可以录入单位成本，也可以录入期初成本<br />
					&nbsp;&nbsp;录入单位成本时，期初成本=数量乘以单位成本，保留两位小数<br />
					&nbsp;&nbsp;录入期初成本时，单位成本=期初成本/数量，根据系统参数中的单价小数位保留小数
				</p>
				<p>由于计算公式不同，有可能出现不同期初分录，单位成本与数量相同，期初成本不一致，或者期初成本与数量相同的现象，单位成本不一致的现象，此为正常情况<br />
					&nbsp;&nbsp;例如，期初数量均为3334：<br />
					&nbsp;&nbsp;&nbsp;&nbsp;录入单位成本1.666时，期初成本=5555.4444≈5555.44<br />
					&nbsp;&nbsp;&nbsp;&nbsp;录入期初成本5555.01时，单位成本=5555.01/3334=1.666
				</p>
				<p>两种录入方式，计算公式不同，得到的单位成本就会不一致，此为正常误差</p>
				<p>系统计算期初的成本时，将会以期初成本为准。</p>
			</div>
		</span>
		<!--<h2  class="h_tit">期初设置</h2>-->
		<div id="earlyStage-wrap" class="manage-wrap ml20 dn">

			<br />
			<div class="cf">
				<!-- <h3>期初设置</h3> -->
				<div class="contacters">
					<div class="grid-wrap">
						<table id="grid">
						</table>
						<div id="page"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<br /><br />
</div>

<input id="upfiles" style="display: none;" type="file" name="files[]" multiple>
<img src="" width=250 height=250 class="imgView dn"></div>
<div id="patchInputBox" class="shadow target_box dn"></div>



<!--  以隐藏的方式获取仓库的样式 ，作用是样式 -->
<div id="p_store_id" style="display: none"></div>
<!--  以隐藏的方式获取商品的样式 ，作用是赋值 -->
<div style="display:none;">
	<input type="text" id="id" value="{$info.id}" autocomplete="off" readonly="">
	<input type="text" id="store_id" value="{$info.store_id}" autocomplete="off" readonly="">
	<input type="text" id="store_name" value="" autocomplete="off" readonly="">
	<input type="text" id="is_multi_unit" value="{$info.is_multi_unit}" autocomplete="off" readonly="">
	<input type="text" id="unit" value="{$info.unit}" autocomplete="off" readonly="">
	<input type="text" id="multi_unit" value="{$info.multi_unit}" autocomplete="off" readonly="">
	<input type="text" id="first_out_unit" value="{$info.first_out_unit}" autocomplete="off" readonly="">
	<input type="text" id="first_in_unit" value="{$info.first_in_unit}" autocomplete="off" readonly="">
	<input type="text" id="is_stock_warning" value="{$info.is_stock_warning}" autocomplete="off" readonly="">
	<input type="text" id="is_fc_warning" value="{$info.is_fc_warning}" autocomplete="off" readonly="">
	<input type="text" id="is_attr_setting" value="{$info.is_attr_setting}" autocomplete="off" readonly="">
	<input type="text" id="is_sn_manager" value="{$info.is_sn_manager}" autocomplete="off" readonly="">
	<input type="text" id="is_begin_setting" value="{$info.is_begin_setting}" autocomplete="off" readonly="">
</div>
<!-- 仓库弹窗 -->
<div class="ui-droplist-wrap" id="ck_wrap" style="position: absolute; z-index: 1000; width: 190px;display:none;">
	<div class="droplist" id="ck_list" style="position: relative; overflow: auto; min-height: 150px; height: 150px;">
		{volist name="store" id="vo"}
		<div class="list-item" store_id="{$vo.id}" title="{$vo.name}">{$vo.name}</div>
		{/volist}
	</div>
</div>


<script src="/public/static/admin/easyui/layui-v2.6.8/layui.js"></script>
<script type="text/javascript" src="/public/static/admin/easyui/jeasyui/jquery.easyui.min.js"></script>

<!-- 编辑 -->
<script>
	var is_multi_unit='{$info.is_multi_unit}';   //是否多单位
	var is_stock_warning='{$info.is_stock_warning}';  //是否启用库存预警
	var is_fc_warning='{$info.is_fc_warning}';  //是否启用分仓预警
	var is_attr_setting='{$info.is_attr_setting}';  //是否根据属性设置
	var is_sn_manager='{$info.is_sn_manager}';  //启用序列号管理
	var is_begin_setting='{$info.is_begin_setting}';  //期初设置

	$(document).ready(function () {
		// 判断 是否多单位
		if(is_multi_unit==1){
			$(".duodanwei_show").show();
			$(".duodanwei_hide").hide();
			$("#moreUnitBtn").prop("checked", true);
		}else{
			$(".duodanwei_show").hide();
			$(".duodanwei_hide").show();
			$("#moreUnitBtn").prop("checked", false);
		}

		// 判断 是否启用库存预警
		if(is_stock_warning==1){
			$("#manage-wrap").show();
			$("#kucunyujingId").prop("checked", true);
		}else{
			$("#manage-wrap").hide();
			$("#kucunyujingId").prop("checked", false);
		}

		// 判断 是否启用分仓预警
		if(is_fc_warning==1){
			$("#manage_set").show();
			$("#manage-kc-table").show();
			$("#manage-kc-info").hide();
			$("#fencangyujingId").prop("checked", true);
		}else{
			$("#manage_set").hide();
			$("#manage-kc-table").hide();
			$("#manage-kc-info").show();
			$("#fencangyujingId").prop("checked", false);
		}

		// 判断 是否根据属性设置
		if(is_attr_setting==1){
			$("#chkattrsettingId").prop("checked", true);
		}else{
			$("#chkattrsettingId").prop("checked", false);
		}

		// 判断 启用序列号管理
		if(is_attr_setting==1){
			$("#isSerNum").prop("checked", true);
		}else{
			$("#isSerNum").prop("checked", false);
		}

		// 判断 期初设置
		if(is_begin_setting==1){
			$("#earlyStage-wrap").show();
			$("#earlyStage").prop("checked", true);
		}else{
			$("#earlyStage-wrap").hide();
			$("#earlyStage").prop("checked", false);
		}




	})
</script>

<script>
	var edit_row = 0;
	var edit_col = 0;
	var row_id = 0;
	var col_name = 0;

	var edit_row1 = 0;
	var edit_col1 = 0;
	var row_id1 = 0;
	var col_name1 = 0;

	var edit_row2 = 0;
	var edit_col2 = 0;
	var row_id2 = 0;
	var col_name2 = 0;

	$(document).ready(function () {

		// 多单位表格
		$("#priceManage").jqGrid({
			// url: '/admin/staff/index.html?ajax=100',
			datatype: "local",//数据来源，本地数据（local，json,jsonp,xml等）
			height: '160px',//高度，表格高度。可为数值、百分比或'auto'
			//width: Public.setGrid().w,
			//height: Public.setGrid().h,
			colNames: ['id', '', '计量单位', '零售价', '批发价', 'VIP会员价', '折扣率一(%)', '折扣率二(%)', '预计采购价', 'id'],
			colModel: [
				{ name: 'unit_id', index: 'id', width: 40, hidden: true },
				{ name: 'unit_type', index: 'name asc', width: 116, editable: false },
				{ name: 'name', index: 'name asc', width: 126, lable: "计量单位", editable: false },
				{ name: 'sale_price', index: 'name asc', lable: "零售价", width: 152, editable: true },
				{ name: 'batch_price', index: 'name asc', lable: "批发价", width: 152, editable: true },
				{ name: 'vip_price', index: 'name asc', lable: "VIP会员价", width: 152, editable: true },
				{ name: 'discount_rate_one', index: 'name asc', lable: "折扣率一(%)", width: 152, editable: true },
				{ name: 'discount_rate_two', index: 'name asc', lable: "折扣率二(%)", width: 152, editable: true },
				{ name: 'estimated_purchase_price', index: 'name asc', lable: "预计采购价", width: 152, editable: true },
				{ name: 'id', index: 'id', width: 40, hidden: true },
			],
			cellEdit: true,
			cellurl: '/',
			// cellsubmit:false,
			rowNum: 10,
			rowList: [10, 20, 30],
			sortname: 'id',
			sortorder: "desc",
			pagerpos: "left",//分页位置

			pgbuttons: true,//翻页按钮
			pagination: true,
			altRows: !0,
			gridview: !0,
			shrinkToFit: !1,
			cellLayout: 8,
			autowidth: !0,
			pager: "#pageWarning",
			viewrecords: !0,
			cmTemplate: {
				sortable: !1,
				title: !1
			},
			loadError: function (t, e, i) {
				parent.Public.tips({
					type: 1,
					content: "操作失败了哦，请检查您的网络链接！"
				})
			}
		});
		var mydata2 = [];
		var price_strategy={$info.price_strategy};
		// console.log(price_strategy);
		for (var i = 0; i < price_strategy.length; i++) {
			var unit_type_text='';
			if(i==0){
				unit_type_text="基本单位";
			}else {
				unit_type_text="副单位"+i;
			}
			var obj = { unit_id: price_strategy[i].unit_id, unit_type: unit_type_text, name:price_strategy[i].name, sale_price:price_strategy[i].sale_price, batch_price:price_strategy[i].batch_price, vip_price:price_strategy[i].vip_price, discount_rate_one:price_strategy[i].discount_rate_one, discount_rate_two:price_strategy[i].discount_rate_two, estimated_purchase_price:price_strategy[i].estimated_purchase_price, id:price_strategy[i].id}
			mydata2.push(obj);
		};
		for (var i = 0; i <= mydata2.length; i++) {
			jQuery("#priceManage").jqGrid('addRowData', i + 1, mydata2[i]);
		}



		// 库存预警表格
		$("#gridWarning").jqGrid({
			// url: '/admin/staff/index.html?ajax=100',
			datatype: "local",//数据来源，本地数据（local，json,jsonp,xml等）
			height: '220px',//高度，表格高度。可为数值、百分比或'auto'
			//width: Public.setGrid().w,
			//height: Public.setGrid().h,
			colNames: ['', '仓库', '最低库存<small id="batchLowQty">批量</small>', '最高库存<small id="batchHighQty">批量</small>', 'id'],
			colModel: [
				{ name: 'store_id', index: 'id', width: 40, hidden: true },
				{ name: 'cangku', width: 263, editable: false },
				{ name: 'low_stock', index: 'name asc', width: 197, editable: true },
				{ name: 'max_stock', index: 'telephone asc', width: 197, editable: true },
				{ name: 'id', index: 'id', width: 40, hidden: true },
			],
			cellEdit: true,
			cellurl: '/',
			// cellsubmit:false,
			rowNum: 10,
			rowList: [10, 20, 30],
			sortname: 'id',
			sortorder: "desc",
			pagerpos: "left",//分页位置
			rownumbers: true,  //自增序号
			pgbuttons: true,//翻页按钮
			pagination: true,
			altRows: !0,
			gridview: !0,
			shrinkToFit: !1,
			cellLayout: 8,
			autowidth: !0,
			pager: "#pageWarning",
			viewrecords: !0,
			cmTemplate: {
				sortable: !1,
				title: !1
			},
			loadError: function (t, e, i) {
				parent.Public.tips({
					type: 1,
					content: "操作失败了哦，请检查您的网络链接！"
				})
			}
		});
		var mydata = [];
		var store = {$store_ew};
		var stock_warning={$info.stock_warning};

		for (let index = 0; index < stock_warning.length; index++) {
			const element = store[index];
			var obj = { store_id: element.id, cangku: element.name, low_stock: stock_warning[index].low_stock, max_stock: stock_warning[index].max_stock, id: stock_warning[index].id};
			mydata.push(obj);
		}
		for (var i = 0; i <= mydata.length; i++) {
			jQuery("#gridWarning").jqGrid('addRowData', i + 1, mydata[i]);
		}


		// 期初设置表格
		$("#grid").jqGrid({
			// url: '/admin/staff/index.html?ajax=100',
			datatype: "local",//数据来源，本地数据（local，json,jsonp,xml等）
			height: '320px',//高度，表格高度。可为数值、百分比或'auto'
			//width: Public.setGrid().w,
			//height: Public.setGrid().h,
			colNames: ['', ' ', '<span class="red">*</span>仓库', '<span class="red">*</span>初期数量', '单位成本', '初期总价', 'id'],
			colModel: [
				{ name: 'store_id', index: 'id', width: 60, hidden: true },
				{ name: '', width: 60, formatter: cLink },
				{
					name: "store_name",
					width: 190,
					link: "inventory",
					editable: true,
					edittype: "custom",
					editoptions: {
						custom_element: function (t, e) {
							$("#p_store_id").html('<div class="pr" id="store_id"><input type="text" class="textbox storageAuto customelement ui-combo-active" name="locationName" autocomplete="off" id="1_locationName" style="outline: -webkit-focus-ring-color auto 5px;"><span class="ui-icon-triangle-1-s" id="st_id"></span></div>');
							return $("#store_id");
						},
						custom_value: function (t, e, a) {
							var ba = $("#store_name").val();
							$("#store_name").val("");
							return ba;
						},

						trigger: "ui-icon-triangle-1-s"
					}
				},

				{ name: 'begin_num', width: 160, label: "初期数量", editable: !0 , align:"right"},
				{ name: 'cost_price', width: 160, label: "单位成本", editable: !0 , align:"right"},
				{ name: 'begin_total_price', width: 160, label: "初期总价", editable: !0 , align:"right"},
				{ name: 'id', index: 'id', width: 60, hidden: true },
			],
			cellEdit: true,
			cellurl: '/',

			rowNum: 10,
			rowList: [10, 20, 30],
			sortname: 'id',
			sortorder: "desc",
			pagerpos: "left",//分页位置
			rownumbers: true,  //设置自增序号
			pgbuttons: true,//翻页按钮
			pagination: false,
			altRows: !0,
			gridview: !0,
			shrinkToFit: !1,
			cellLayout: 8,
			autowidth: !0,
			pager: "#pageWarning",
			viewrecords: !0,
			cmTemplate: {
				sortable: !1,
				title: !1
			},
			loadError: function (t, e, i) {
				parent.Public.tips({
					type: 1,
					content: "操作失败了哦，请检查您的网络链接！"
				})
			},
			// 合计
			footerrow: true,
			gridComplete: function () {
				var begin_nums =parseFloat($("#grid").getCol('begin_num', false, 'sum')).toFixed(2);
				var begin_total_prices = parseFloat($("#grid").getCol('begin_total_price', false, 'sum')).toFixed(2);
				$("#grid").footerData('set', { "store_name": '合计', begin_num: begin_nums, begin_total_price: begin_total_prices});
			},
			beforeEditCell: function (rowid, cellname, value, iRow, iCol) {
				col_name = cellname;
				edit_row = iRow;
				edit_col = iCol;
				row_id = rowid;
				var cname = $("#grid").jqGrid("getCell", row_id, 'store_name');
				$("#store_name").val(cname);
			},
			beforeSaveCell: function (rowid, cellname, value, iRow, iCol) {
				edit_row = iRow;
				edit_col = iCol;
				row_id = rowid;

				var begin_nums = $("#grid").getCol('begin_num', false, 'sum');
				var begin_total_prices = $("#grid").getCol('begin_total_price', false, 'sum');

				// 重算
				// step1 (取值)
				var begin_num = parseFloat($("#grid").jqGrid("getCell", row_id, 'begin_num'));
				var cost_price = parseFloat($("#grid").jqGrid("getCell", row_id, 'cost_price'));
				var begin_total_price = parseFloat($("#grid").jqGrid("getCell", row_id, 'begin_total_price'));

				// step2 (计算)
				switch (cellname) {
					case 'begin_num':
						if (!isNaN(begin_num) && !isNaN(cost_price)) {
							begin_total_price = parseFloat((begin_num / 1) * (cost_price / 1)).toFixed(2);
						}
						break;
					case 'cost_price':
						if (!isNaN(begin_num) && !isNaN(cost_price)) {
							begin_total_price = parseFloat((begin_num / 1) * (cost_price / 1)).toFixed(2);

						}
						break;
					case 'begin_total_price':
						if (!isNaN(begin_num) && !isNaN(cost_price) && !isNaN(begin_total_price)) {
							cost_price = parseFloat((begin_total_price / 1) / (begin_num / 1)).toFixed(2);
						}
						break;
					default:
						break;
				}

				

				// step3 (赋值)
				$("#grid").jqGrid("setCell", row_id, 'begin_num', begin_num);
				$("#grid").jqGrid("setCell", row_id, 'cost_price', cost_price);
				$("#grid").jqGrid("setCell", row_id, 'begin_total_price', begin_total_price);

				// 计算合计
				if(cellname == "begin_num"){
 
					begin_total_prices = parseFloat($("#grid").getCol('begin_total_price', false, 'sum')).toFixed(2);
					if($("#grid").getCol('begin_num', false, 'sum')==0){
						begin_nums=parseFloat($("#grid").getCol('begin_num', false, 'sum')/1 + value/1).toFixed(2);
					}

				}else if(cellname == "begin_total_price"){

					begin_nums = parseFloat($("#grid").getCol('begin_num', false, 'sum')).toFixed(2);

				}else{
					begin_nums = parseFloat($("#grid").getCol('begin_num', false, 'sum')).toFixed(2);
					begin_total_prices = parseFloat($("#grid").getCol('begin_total_price', false, 'sum')).toFixed(2);
				}
				// 合计赋值
				$("#grid").footerData('set', { "store_name": '合计', begin_num: begin_nums, begin_total_price:begin_total_prices });
			},
		});

		var mydata1 = [];
		var begin_setting={$info.begin_setting};

		for (var i = 0; i < begin_setting.length; i++) {
			var obj = { store_id: begin_setting[i].store_id, store_name: begin_setting[i].store_name, begin_num: begin_setting[i].begin_num, cost_price: begin_setting[i].cost_price, begin_total_price: begin_setting[i].begin_total_price, id: begin_setting[i].id}
			mydata1.push(obj);
		};
		for (let index = begin_setting.length; index < 8; index++) {
			var obj = { id: index + 1}
			mydata1.push(obj);
		}
		for (var i = 0; i <= mydata1.length; i++) {
			jQuery("#grid").jqGrid('addRowData', i + 1, mydata1[i]);
		}

	})
	// 增加、删除按钮
	function cLink(cellvalue, options, rowObject) {
		return '<div class="operating"><span class="ui-icon ui-icon-plus" title="新增行" onclick="add()" style="margin-left:8px;"></span> <span class="ui-icon ui-icon-trash" onclick="del(' + rowObject.id + ')" style="margin-left:8px;">删除</span></div>';
	}





</script>

<script>
	$(document).ready(function () {
		// 商品编号
		$("#tipsNum").hover(function () {
			$("#tipsBoxNum").css({ 'position': 'absolute', 'left': '60.1562px', 'top': '83px', 'z-index': '999', 'display': 'block' })
		}, function () {
			$("#tipsBoxNum").css({ 'position': '', 'left': '', 'top': '', 'z-index': '', 'display': '' })
		})

		// 多单位提示
		$("#tips").hover(function () {
			var top = $(this).offset().top;
			var left = $(this).offset().left;
			$("#tipsBox").css({ 'position': 'absolute', 'left': (left - 40) + 'px', 'top': (top + 20) + 'px', 'z-index': '999', 'display': 'block' })
		}, function () {
			$("#tipsBox").css({ 'position': '', 'left': '', 'top': '', 'z-index': '', 'display': '' })
		})

		// 期初设置提示
		$("#remindTitSecond").hover(function () {
			var top = $(this).offset().top;
			var left = $(this).offset().left;
			$("#remindTitBoxSecond").css({ 'position': 'absolute', 'left': (left + 0) + 'px', 'top': (top - 330) + 'px', 'z-index': '999', 'display': 'block' })
		}, function () {
			$("#remindTitBoxSecond").css({ 'position': '', 'left': '', 'top': '', 'z-index': '', 'display': '' })
		})

		// 下拉选择
		$(".ctn-wrap_baseInfo .trigger").click(function () {
			$(this).parent().next(".ui-droplist-wrap").toggle();
		});


		// 点击下拉框其他位置隐藏
		$(document).click(function () {
			$(".baseInfoPopupBox").hide();
		});
		// 阻止冒泡
		$(".ctn-wrap_baseInfo").click(function (event) {
			event.stopPropagation();
		});
	});

	// 选择
	function chooseSelect(id, value, text) {
		$("#storageInput" + id).val(text);
		storageList(id);
		switch (id) {
			case '1':
				// 首选仓库
				$('#store_id').val(value);
				break;
			case '2':
				// 计量单位
				$('#unit').val(value);
				break;
			case '3':
				$('#multi_unit').val(value);
				// 多计量单位
				if (value != 0) {
					$.get("/admin/basic/list_unit.html", { pid: value }, function (data, state) {
						if (data.status == 1) {
							var mydata2 = [];
							//组装数据
							for (var i = 0; i < data.list.length; i++) {
								if (i == 0) {
									var obj = { unit_id: data.list[i]['id'], unit_type: '基本单位', name: data.list[i]['name'] }
								} else {
									var obj = { unit_id: data.list[i]['id'], unit_type: '副单位' + i, name: data.list[i]['name'] }
								}
								mydata2.push(obj);
							};
							$("#priceManage").jqGrid("clearGridData");
							for (var i = 0; i <= mydata2.length; i++) {
								jQuery("#priceManage").jqGrid('addRowData', i + 1, mydata2[i]);
							}
							//设置首选出库单位
							$('#outstock').html("<div class=\"list-item\" onclick=\"chooseSelect('4', '0', '(空)')\">(空)</div>");
							for (let index = 0; index < data.list.length; index++) {
								const element = data.list[index];
								$('#outstock').append("<div class=\"list-item\" onclick=\"chooseSelect('4', '" + element.id + "', '" + element.name + "')\">" + element.name + "</div>")
							}

							//设置首选入库单位
							$('#instock').html("<div class=\"list-item\" onclick=\"chooseSelect('5', '0', '(空)')\">(空)</div>");
							for (let index = 0; index < data.list.length; index++) {
								const element = data.list[index];
								$('#instock').append("<div class=\"list-item\" onclick=\"chooseSelect('5', '" + element.id + "', '" + element.name + "')\">" + element.name + "</div>")
							}

						} else {
							layer.msg("获取商品信息失败");
						}
					})
				} else {
					$("#priceManage").jqGrid("clearGridData");
				}
				break;
			case '4':
				// 首选出库单位
				$('#first_out_unit').val(value);
				break;
			case '5':
				// 首选入库单位
				$('#first_in_unit').val(value);
				break;
			default:
				break;
		}
	}

	// 关闭下拉选择
	function storageList(id) {
		$("#storageList" + id).hide();
	}



	$(document).ready(function () {
		// 选择仓库弹窗
		$(".grid-wrap").on("click", ".ui-icon-triangle-1-s", function (e) {
			var top = $(this).offset().top;
			var left = $(this).offset().left;
			$("#ck_wrap").slideToggle();
			$("#ck_wrap").css({ "top": (top + 22) + "px", "left": (left - 170) + "px" })
		})
		//选择仓库赋值
		$("#ck_wrap #ck_list").on("click", ".list-item", function (e) {
			var title = $(this).attr("title");
			//仓库1
			if (col_name == "store_name") {
				var store_id = $(this).attr("store_id");
				$("#store_name").val(title);
				$("#grid").jqGrid("setCell", row_id, 'store_id', store_id);
				$("#grid").jqGrid("setCell", row_id, 'store_name', title);//及时保存
			}
			$("#grid").saveRow(row_id, false);
			$("#ck_wrap").hide();
		});
	})
	//仓库选择框外点击则隐藏
	$(document).mouseup(function (e) {
		if (e.target.id != "st_id") {
			var con = $("#ck_wrap");   // 设置目标区域
			if (!con.is(e.target) && con.has(e.target).length === 0) {
				$("#ck_wrap").hide();
			}
		}
	});
</script>


<script>
	$(document).ready(function () {
		layui.use(['form', 'layer', 'jquery'], function () {
			// $ = layui.jquery;
			var layer = layui.layer,
				form = layui.form;
			//监听多选框点击事件(监听多单位是否勾选)  主要是通过 lay-filter="chkduodanwei"  来监听
			form.on('checkbox(chkduodanwei)', function (data) {
				// 　　console.log( data );　　//打印当前选择的信息
				if (data.elem.checked) {　　　　　　//判断当前多选框是选中还是取消选中
					// alert('当前选中');
					$(".duodanwei_show").show();
					$(".duodanwei_hide").hide();
					$('#is_multi_unit').val(1);
				} else {
					$(".duodanwei_show").hide();
					$(".duodanwei_hide").show();
					$('#is_multi_unit').val(0);
				}
			});

			//监听多选框点击事件(监听库存预警是否勾选)  主要是通过 lay-filter="chkKucunyujing"  来监听
			form.on('checkbox(chkKucunyujing)', function (data) {
				// 　　console.log( data );　　//打印当前选择的信息
				if (data.elem.checked) {　　　　　　//判断当前多选框是选中还是取消选中
					// alert('当前选中');
					$("#manage-wrap").show();
					$('#is_stock_warning').val(1);
				} else {
					$("#manage-wrap").hide();
					$('#is_stock_warning').val(0);
				}
			});

			//监听多选框点击事件(监听分仓预警是否勾选)  主要是通过 lay-filter="chkFencangyujing"  来监听
			form.on('checkbox(chkFencangyujing)', function (data) {
				// 　　console.log( data );　　//打印当前选择的信息
				if (data.elem.checked) {　　　　　　//判断当前多选框是选中还是取消选中
					// alert('当前选中');
					$("#manage_set").show();
					$("#manage-kc-table").show();
					$("#manage-kc-info").hide();
					$('#is_fc_warning').val(1);
				} else {
					$("#manage_set").hide();
					$("#manage-kc-table").hide();
					$("#manage-kc-info").show();
					$('#is_fc_warning').val(0);
				}
			});

			//监听多选框点击事件(监听期初设置是否勾选)  主要是通过 lay-filter="chkqichushezhi"  来监听
			form.on('checkbox(chkqichushezhi)', function (data) {
				// 　　console.log( data );　　//打印当前选择的信息
				if (data.elem.checked) {　　　　　　//判断当前多选框是选中还是取消选中
					// alert('当前选中');
					$("#earlyStage-wrap").show();
					$('#is_begin_setting').val(1);
				} else {
					$("#earlyStage-wrap").hide();
					$('#is_begin_setting').val(0);
				}
			});

			//监听根据属性设置 lay-filter="chkattrsetting"
			form.on('checkbox(chkattrsetting)', function (data) {
				// 　　console.log( data );　　//打印当前选择的信息
				if (data.elem.checked) {　　　　　　//判断当前多选框是选中还是取消选中
					$('#is_attr_setting').val(1);
				} else {
					$('#is_attr_setting').val(0);
				}
			});

			//监听启动序列号管理设置 lay-filter="chksn_manager"
			form.on('checkbox(chksn_manager)', function (data) {
				// 　　console.log( data );　　//打印当前选择的信息
				if (data.elem.checked) {　　　　　　//判断当前多选框是选中还是取消选中
					$('#is_sn_manager').val(1);
				} else {
					$('#is_sn_manager').val(0);
				}
			});
		});
	});
</script>
<script>
	var imgnum = {$info.imgsnum};
	$("#FileUpload").change(function () {
		var fileObj = document.getElementById("FileUpload").files[0]; // js 获取文件对象
		var formData = new FormData();
		formData.append('image', fileObj);
		$.ajax({
			url: '/admin/basic/upload_img.html',
			dataType: 'json',
			type: 'POST',
			async: false,
			data: formData,
			processData: false, // 使数据不做处理
			contentType: false, // 不要设置Content-Type请求头
			success: function (res) {
				if (res.status == 1) {
					var html = "<span class=\"item_span\"> \
						<a href=/public/uploads/good/"+ res.info.path + "\
						data-lightbox=\"roadtrip\"><img class=\"item sonimgs\"src=/public/uploads/good/"+ res.info.path + "\
						data-id="+ res.info.id + "></a>\
						<a class=\"del imgdel\" href=\"javascript:\" del=\"0\"></a>";

					if (imgnum == 0) {
						html += "<a id=\"mainimg\" class=\"important_set\" href=\"javascript:\" important=\"0\">主图</a></span>";
					} else {
						html += "<a class=\"important setmainimg\" href=\"javascript:\" important=\"1\">设为主图</a></span>";
					}
					// <a class=\"important_set\" href=\"javascript:\" important=\"0\">主图</a></span>
					// <a class=\"important\" href=\"javascript:\" important=\"1\">设为主图</a></span>
					$("#addimgs").before(html);
					imgnum++;
					// $("#imgs").append("<span class=\"item_span\"> \
					// <a href=http://jxc.1.a/public/uploads/"+ res.info + "\
					// data-lightbox=\"roadtrip\"><img class=\"item\"src=http://jxc.1.a/public/uploads/"+ res.info + "\
					// data-pid=\"undefined\"></a>\
					// <a class=\"del\" href=\"javascript:\" del=\"0\"></a>\
					// <a class=\"important_set\" href=\"javascript:\" important=\"0\">主图</a></span>");
				} else {
					$.messager.alert('提示', res.msg, 'error');
				}

			},
			error: function (response) {
				//$("#logo_img").val('');
				$.messager.alert('提示', '接口错误', 'error');
			}
		});
	})

	$("#imgs").delegate('.imgdel', 'click', function () {
		$(this).parent().remove();
	});

	$("#imgs").delegate('.setmainimg', 'click', function () {
		// 设置为主图（移动到第一位）
		$('#imgs').prepend($(this).parent());
		// 添加主图的文字
		$(this).parent().append($('#mainimg'));
		// 移除设为主图的文字
		$(this).remove();
		// 设置设为主图的文字
		$("#imgs .item_span").eq(1).append("<a class=\"important setmainimg\" href=\"javascript:\" important=\"1\">设为主图</a></span>");
	});

	$('#save').click(function () {
		savedata();
	});

	function savedata() {
		// 基础资料
		var id = $('#id').val(); 
		var sn = $('#sn').val();
		var name = $('#name').val();
		var code = $('#code').val();
		var model = $('#model').val();
		var goods_category_id = $('#goods_category_id').val();
		var store_id = $('#store_id').val();
		var unit = $('#unit').val();
		var is_multi_unit = $('#is_multi_unit').val();
		var multi_unit = $('#multi_unit').val();
		var first_out_unit = $('#first_out_unit').val();
		var first_in_unit = $('#first_in_unit').val();

		// 价格策略
		var sale_price = $('#sale_price').val();
		var batch_price = $('#batch_price').val();
		var vip_price = $('#vip_price').val();
		var discount_rate_one = $('#discount_rate_one').val();
		var discount_rate_two = $('#discount_rate_two').val();
		var estimated_purchase_price = $('#estimated_purchase_price').val();
		var price_strategy = getJQAllData($("#priceManage"));
		var mark = $('#mark').val();

		// 获取剩余图片id
		var sonimgs = $('.sonimgs');
		var imgsList = [];
		for (let index = 0; index < sonimgs.length; index++) {
			imgsList.push($(sonimgs[index]).attr('data-id'));
		}

		// 库存预警
		var is_stock_warning = $('#is_stock_warning').val();
		var is_attr_setting = $('#is_attr_setting').val();
		var is_fc_warning = $('#is_fc_warning').val();

		var low_stock = $('#low_stock').val();
		var max_stock = $('#max_stock').val();
		var stock_warning = getJQAllData($("#gridWarning"));
		var is_sn_manager = $('#is_sn_manager').val();

		// 初期设置
		var is_begin_setting = $('#is_begin_setting').val();
		var begin_setting = getJQAllData($("#grid"));

		$.ajax({
			type: 'POST',
			url: "update.html",
			data: {
				id: id,
				sn: sn,
				name: name,
				code: code,
				model: model,
				goods_category_id: goods_category_id,
				store_id: store_id,
				unit: unit,
				is_multi_unit: is_multi_unit,
				multi_unit: multi_unit,
				first_out_unit:first_out_unit,
				first_in_unit:first_in_unit,
				sale_price: sale_price,
				batch_price: batch_price,
				vip_price: vip_price,
				discount_rate_one: discount_rate_one,
				discount_rate_two: discount_rate_two,
				estimated_purchase_price: estimated_purchase_price,
				price_strategy: price_strategy,
				mark: mark,
				imgsList: imgsList,
				is_stock_warning: is_stock_warning,
				is_attr_setting: is_attr_setting,
				is_fc_warning: is_fc_warning,
				low_stock: low_stock,
				max_stock: max_stock,
				stock_warning: stock_warning,
				is_sn_manager: is_sn_manager,
				is_begin_setting: is_begin_setting,
				begin_setting: begin_setting
			},
			dataType: "json",
			async: false,
			error: function (request) {
				layer.msg("发送请求失败！");
			},
			success: function (data) {
				if (data.status == 1) {
					layer.msg(data.msg);
				} else {
					layer.msg(data.msg);
				}

			}
		});

	}

	function getJQAllData(obj) {
		//获取grid表中所有的rowid值
		var rowIds = obj.getDataIDs();
		//初始化一个数组arrayData容器，用来存放rowData
		var arrayData = new Array();

		if (rowIds.length > 0) {
			for (var i = 0; i < rowIds.length; i++) {
				if (Object.values(obj.getRowData(rowIds[i]))[2] != '') {
					arrayData.push(obj.getRowData(rowIds[i]));
				}
				//rowData=obj.getRowData(rowid);//这里rowid=rowIds[i];
				// console.log(obj.getRowData(rowIds[i].goodsname));
				// return false;
				// if (obj.getRowData(rowIds[i].goodsname != '')) {
				//   arrayData.push(obj.getRowData(rowIds[i]));
				// }
			}
		}
		return arrayData;
	}
</script>
{include file="public/footer"/}